package com.tuo.beans;

import com.tuo.beans.enums.Algorithm;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Transient;
import java.math.BigDecimal;
import java.util.List;

/**
 * Created by tuo on 2016/1/9.
 *
 * @author tuo
 *         订单详情表
 */
@Entity
public class Detail {
    private long id;
    /**
     * 订单ID
     */
    private long ordId;
    /**
     * 详情名称
     */
    private String name;
    /**
     * 数量
     */
    private int number;
    /**
     * 归还数量
     */
    private int returnNumber;
    /**
     * 开始日期
     */
    private String start;
    /**
     * 结束日期
     */
    private String stop;
    /**
     * 截止目前为止以归还及未归还的总金额
     */
    private BigDecimal price;
    /**
     * 单价
     */
    private BigDecimal unitPrice;
    /**
     * 按照固定日计算则为天，按照面积计算则为面积
     */
    private String params;
    /**
     * 价格计算类型
     */
    private Algorithm algorithm;
    /**
     * 报停详情
     */
    private List<Stopped> stoppeds;


    public Detail() {
    }

    public Detail(long ordId) {
        this.ordId = ordId;
    }

    @Id
    @GeneratedValue
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public long getOrdId() {
        return ordId;
    }

    public int getReturnNumber() {
        return returnNumber;
    }

    public void setReturnNumber(int returnNumber) {
        this.returnNumber = returnNumber;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public void setOrdId(long ordId) {
        this.ordId = ordId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public BigDecimal getUnitPrice() {
        return unitPrice;
    }

    public void setUnitPrice(BigDecimal unitPrice) {
        this.unitPrice = unitPrice;
    }

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public String getStart() {
        return start;
    }

    public void setStart(String start) {
        this.start = start;
    }

    public String getStop() {
        return stop;
    }

    public void setStop(String stop) {
        this.stop = stop;
    }

    @Transient
    public List<Stopped> getStoppeds() {
        return stoppeds;
    }

    public void setStoppeds(List<Stopped> stoppeds) {
        this.stoppeds = stoppeds;
    }

    public String getParams() {
        return params;
    }

    public void setParams(String params) {
        this.params = params;
    }

    public Algorithm getAlgorithm() {
        return algorithm;
    }

    public void setAlgorithm(Algorithm algorithm) {
        this.algorithm = algorithm;
    }

    @Override
    public String toString() {
        return "Detail{" +
                "id=" + id +
                ", ordId=" + ordId +
                ", name='" + name + '\'' +
                ", number=" + number +
                ", returnNumber=" + returnNumber +
                ", start='" + start + '\'' +
                ", stop='" + stop + '\'' +
                ", price=" + price +
                ", unitPrice=" + unitPrice +
                ", params=" + params +
                ", algorithm=" + algorithm +
                ", stoppeds=" + stoppeds +
                '}';
    }
}
